package com.xb.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author xbyan
 * @date 2023/7/8 0:22
 */
@RestController
@RequestMapping("/api/admin")
public class AdminController {

//    @RequiresPermissions("system:drug:*")
////    @RequiresRoles(value = {"admin", "drugStoreAdmin"}, logical = Logical.OR)
//    @RequestMapping("/drug")
//    public ModelAndView drug() {
//
//        return new ModelAndView("view/drug");
//    }

    @RequiresPermissions("system:drug:*")
//    @RequiresRoles(value = {"admin", "drugStoreAdmin"}, logical = Logical.OR)
    @RequestMapping("/drug")
    public ModelAndView drug() {
        return new ModelAndView("admin/drug");
    }

    @RequiresPermissions("system:drug:*")
//    @RequiresRoles(value = {"admin", "drugStoreAdmin"}, logical = Logical.OR)
    @RequestMapping("/role")
    public ModelAndView role() {
        return new ModelAndView("admin/role");
    }

    @RequiresPermissions("system:drug:*")
//    @RequiresRoles(value = {"admin", "drugStoreAdmin"}, logical = Logical.OR)
    @RequestMapping("/user")
    public ModelAndView user() {
        return new ModelAndView("admin/user");
    }

    @RequestMapping("/dict")
    @RequiresPermissions("system:dict:*")
    public ModelAndView dict() {
        return new ModelAndView("admin/dict");
    }

    @RequestMapping("/department")
    @RequiresPermissions("system:department:*")
    public ModelAndView department() {
        return new ModelAndView("admin/department");
    }

    @RequestMapping("/menu")
    @RequiresPermissions("system:loginInfo:*")
    public ModelAndView menu() {
        return new ModelAndView("admin/menu");
    }

    @RequestMapping("/announcement")
    @RequiresPermissions("system:announcement:*")
    public ModelAndView announcement() {
        return new ModelAndView("admin/announcement");
    }


    @RequestMapping("/loginInfo")
    @RequiresPermissions("system:menu:*")
    public ModelAndView loginInfo() {
        return new ModelAndView("admin/loginInfo");
    }


    @RequestMapping("/patient")
    @RequiresPermissions("system:patient:*")
    public ModelAndView patient() {
        return new ModelAndView("admin/patient");
    }

    @RequestMapping("/stock")
    @RequiresPermissions("system:stock:*")
    public ModelAndView stock() {
        return new ModelAndView("admin/stock");
    }


    @RequestMapping("/dicttype")
    @RequiresPermissions("system:dicttype:*")
    public ModelAndView dicttype() {
        return new ModelAndView("admin/dicttype");
    }
}
